package WWW.SST.LIB;

/** 
 Account ��ժҪ˵����
*/
public class Account extends MOLE.App.Every
{
	private int Uid = 0;
	public double OutMoney = 0;
	public double InMoney = 0;
//	public double Balance=0;
	public String OutMoneyStr = ""; //�����ܽ�
	public String InMoneyStr = "";
	public String BalanceStr = "";
	public String YonjenStr = "0";
	 public java.math.BigDecimal Balance = new java.math.BigDecimal(0);
	public java.math.BigDecimal BinggoMoney = new java.math.BigDecimal(0);
	public java.math.BigDecimal YonjenMoney = new java.math.BigDecimal(0);
	public java.math.BigDecimal TisyeeMoney = new java.math.BigDecimal(0);
	public java.math.BigDecimal PayMoney = new java.math.BigDecimal(0);
	public String OwenerName = "none";
	public boolean HasAccountInfo = false;

	public String RealName = "";
	public String Sid = "";
//	public string 
	public String AlipayAcc = "";
	public String PayPassword = "";
	public boolean IsFreeze = false;
	public java.math.BigDecimal TotalScore = new java.math.BigDecimal(0);
	public java.math.BigDecimal MoneyFromScore = new java.math.BigDecimal(0);
	public String CashoutType = "all";
�� public Account()
{
}
	public Account(String sn)
	{

	}
	 public Account(int uid)
	 {
		 Uid = uid;
		if (Uid == 0)
		{
			return;
		}

		String s = "exec Account_List  " + String.valueOf(Uid);
		DataTable d = MOLE.SQL.GetDataTable(s);
		if (d.Rows.size() > 0)
		{
			InMoney = MOLE.str.ConvertToDouble(d.Rows[0]["TotalIn"].toString());
			BinggoMoney = MOLE.str.ConverToDecimal(d.Rows[0]["bingomoney"].toString());
			YonjenMoney = MOLE.str.ConverToDecimal(d.Rows[0]["YonjenMoney"].toString());

			PayMoney = MOLE.str.ConverToDecimal(d.Rows[0]["PayMoney"].toString());
			TisyeeMoney = MOLE.str.ConverToDecimal(d.Rows[0]["tisyeMoney"].toString());
			Balance = MOLE.str.ConverToDecimal(d.Rows[0]["balance"].toString());
			OwenerName = d.Rows[0]["hy_name"].toString();
			PayPassword = d.Rows[0]["zhifumima"].toString();
			TotalScore = MOLE.str.ConverToDecimal(d.Rows[0]["score"].toString());
			MoneyFromScore = MOLE.str.ConverToDecimal(d.Rows[0]["moneyscore"].toString());
			CashoutType = d.Rows[0]["cashouttype"].toString();

			if (d.Rows[0]["ifedit"].toString().equals("������"))
			{
				HasAccountInfo = true;
				RealName = d.Rows[0]["realname"].toString();
				try
				{
					Sid = (new WWW.SST.LIB.EncryptDecrypt()).Decrypt(d.Rows[0]["shenfenzheng"].toString());
				}
				catch (java.lang.Exception e)
				{
				}
				 AlipayAcc = d.Rows[0]["zhifubao"].toString();
			}
			else
			{
				HasAccountInfo = false;
			}


			if (d.Rows[0]["zt"].toString().trim().equals("q"))
			{
				IsFreeze = false;
			}
			else
			{
				IsFreeze = true;
			}


		}
	 }


	public final java.math.BigDecimal GetYonjenTotalMoney()
	{
		java.math.BigDecimal r = new java.math.BigDecimal(0);
		String s = " Account_GetYonjenTotalMoney  " + String.valueOf(Uid);
		DataTable d = MOLE.SQL.GetDataTable(s);
		try
		{
			r = (java.math.BigDecimal)(d.Rows[0]["money"].toString());
		}
		catch (java.lang.Exception e)
		{
		}
		return r;

	}

	public final DataTable DetailList(String statrTime, String endTime)
	{
		String s = "exec Account_BankLogView " + String.valueOf(Uid) + " , '" + statrTime + "'" + " , '" + endTime + "'";
		DataTable d = MOLE.SQL.GetDataTable(s);
		return d;

	}

	public final DataTable DetailList2(String statrTime, String endTime)
	{
		String s = "exec Account_Detail_List " + String.valueOf(Uid) + " , '" + statrTime + "'" + " , '" + endTime + "'";
		s = "select * from bank_log order by id desc";
		DataTable d = MOLE.SQL.GetDataTable(s);
		return d;

	}


	public final void SetAccInfo()
	{
		boolean b = false;
		if (this.Sid.length() != 15 && this.Sid.length() != 18)
		{
			this.StausCode = 1;
			this.StausMsg = "���֤���벻��ȷ";
			return;
		}
//			if( !MOLE.PageValidate.IsEmail(  this.AlipayAcc ) )
//			{
//				this.StausCode=1;
//				this.StausMsg="EMAIL����ȷ";
//				return;
//			}
//			


		try
		{
			MOLE.SQLOS o = new MOLE.SQLOS("account_setaccountinfo");
			o.RS(Uid);
			o.RS(RealName);
				String sidstr = (new WWW.SST.LIB.EncryptDecrypt()).Encrypt(Sid);
			o.RS(sidstr);
			o.RS(AlipayAcc);
			o.RS(0);
			o.RS(CashoutType);
			o.ExecStoreProcess();
		}
		catch (RuntimeException ee)
		{
			this.StausCode = 1;
			this.StausMsg = "some err is exceptit ,this err is loged !! ";
			 this.Log("set acc info err", ee.toString());
		}

	}

	public final String ResetPwdSave()
	{
		String sn = MOLE.comm.getRandomChars(15);
		MOLE.SQLOS o = new MOLE.SQLOS("ACC_ResetPwd");
		o.RS(this.Uid);
		o.RS(sn);
		o.ExecStoreProcess();
		return sn;
	}

	public final void ResetPwd(String sn, String newpass)
	{
		try
		{

			MOLE.SQLOS o = new MOLE.SQLOS("ACC_ResetPwd_Exec");
			o.RS(sn);
			o.RS(newpass);
			DataTable d = o.ExecStoreProcess();
			if (d.Rows.size() > 0)
			{
				this.CODE = d.Rows[0]["code"].toString().toLowerCase();
				this.CODEMSG = d.Rows[0]["msg"].toString();
			}

		}
		catch (RuntimeException ee)
		{

			this.CODE = "err";
			this.CODE = "ϵͳ������";
			this.Log("err", ee.toString());
		}

	}


	public final void GetResetPwdUserInfo(String sn)
	{

		try
		{

			MOLE.SQLOS o = new MOLE.SQLOS("ACC_ResetPwd_Exec");
			o.RS(sn);
			o.RS("");
			o.RS(1);
			DataTable d = o.ExecStoreProcess();
			   this.CODE = d.Rows[0]["code"].toString().toLowerCase();
			this.CODEMSG = d.Rows[0]["msg"].toString();


		}
		catch (RuntimeException ee)
		{
			this.CODE = "err";
			 this.CODEMSG = "ϵͳ��������";

			this.Log("err", ee.toString());
		}

	}
//
//		public Decimal  Balance
//		{ 
//			get 
//			{ 
//				//return caption; 
//				string s="select*   from bank where hy_num="+Uid.ToString();
//				DataTable d=MOLE.SQL.GetDataTable(s);
//				try
//				{
//					return Convert.ToDecimal( d.Rows[0]["balance"].ToString()) ;
//				}
//				catch 
//				{
//				return 0;
//				}
//
//				
//			} 
//			set 
//			{ 
////				caption = value; 
////				Repaint(); 
//			} 
//		} 
// 
//




}